<div style="width:90%; margin:40px auto 60px auto;">
	<div class="panel panel-default">
		<div class="panel-heading" style="padding:3px 15px;text-align:right;">
			<div style="width:50%;float:left;margin-top:4px;font-size:18px;">SOLICITANTES</div>
			<button data-toggle="modal" data-target="#editModal" class="btn btn-primary btn-sm" type="button">
				<span class="glyphicon glyphicon-plus-sign"></span> Agregar Solicitantes
			</button>
		</div>
		<div class="panel-body" style="padding-bottom:10px;">
			<table cellpadding="0" cellspacing="0" border="0" id="example" class="table table-striped table-bordered">
				<thead>
					<tr>
						<th style="text-align: center;">USUARIO</th>
						<th style="text-align: center;">NOMBRES</th>
						<th style="text-align: center;">APELLIDOS</th>
						<th style="text-align: center;">DNI</th>
						<th style="text-align: center;">CORREO</th>
						<th style="text-align: center;">UNIDAD</th>
						<th style="text-align: center;">OPCIONES</th>
					</tr>
				</thead>
				<tbody>
					<?php foreach ($solicitantes as $s) { ?>
					<tr>
						<td><?php echo $s['Usuario']['usuario']; ?></td>
						<td><?php echo $s['Solicitante']['nombre']; ?></td>
						<td><?php echo $s['Solicitante']['apellido']; ?></td>
						<td><?php echo $s['Solicitante']['dni']; ?></td>
						<td><?php echo $s['Solicitante']['correo']; ?></td>
						<td><?php echo $s['Unidade']['nombre']; ?></td>
						<td style="text-align: center" id="options">
							<div style="text-align:left;" id="edit" class="btn-group">
							  <button type="button" class="btn btn-success btn-xs">
							  	<span class="glyphicon glyphicon-edit"></span>
							  </button>
							  <button type="button" class="btn btn-success dropdown-toggle btn-xs" data-toggle="dropdown">
								<span class="caret"></span>
							  </button>
							  <ul class="dropdown-menu" role="menu">
								<li><a href="../Solicitantes/editar?id=<?php echo $s['Solicitante']['id']; ?>">Editar</a></li>
								<li><a href="../Solicitantes/contrasena?id=<?php echo $s['Solicitante']['id']; ?>">Cambiar contraseña</a></li>
							  </ul>
							</div>
							<a href="../Solicitantes/borrar?id=<?php echo $s['Solicitante']['id']; ?>" title="Borrar" data-toggle="tooltip" data-placement="right" data-delay="300" >
								<button type="button" class="btn btn-danger btn-xs">
									<span class="glyphicon glyphicon-trash"></span>
								</button>
							</a>
						</td>
					</tr>
					<?php } ?>
				</tbody>
			</table>
		</div>
	</div>
</div>
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
      		<form action="../Solicitantes/listar" method="post" class="form-horizontal" role="form">
	        	<div class="modal-header">
	          		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
	          		<h4 class="modal-title" style="text-align:center;color:#194D89;">AGREGAR SOLICITANTE</h4>
	        	</div>
	        	<div class="modal-body">
	        		<input name="data[Usuario][perfil]" type="hidden" id="input2" value="3">
					<div class="form-group">
				    	<label style="text-align:right;padding-right:0;" for="input1" class="col-lg-2 control-label">Usuario</label>
				    	<div class="col-lg-10">
				      		<input name="data[Usuario][usuario]" type="text" class="form-control" id="input1" placeholder="Usuario">
				    	</div>
				  	</div>
				  	<div class="form-group">
				    	<label style="text-align:right;padding-right:0;" for="inputPassword" class="col-lg-2 control-label">Contraseña</label>
				    	<div class="col-lg-10">
				      		<input name="data[Usuario][contrasena]" type="password" class="form-control" id="inputPassword" placeholder="Contraseña">
				    	</div>
				  	</div>
				  	<div class="form-group">
				    	<label style="text-align:right;padding-right:0;" for="input2" class="col-lg-2 control-label">Nombre</label>
				    	<div class="col-lg-10">
				      		<input name="data[Solicitante][nombre]" type="text" class="form-control" id="input2" placeholder="Nombre">
				    	</div>
				  	</div>
				  	<div class="form-group">
				    	<label style="text-align:right;padding-right:0;" for="input3" class="col-lg-2 control-label">Apellido</label>
				    	<div class="col-lg-10">
				      		<input name="data[Solicitante][apellido]" type="text" class="form-control" id="input3" placeholder="Apellido">
				    	</div>
				  	</div>
				  	<div class="form-group">
				    	<label style="text-align:right;padding-right:0;" for="input4" class="col-lg-2 control-label">DNI</label>
				    	<div class="col-lg-10">
				      		<input name="data[Solicitante][dni]" type="text" class="form-control" id="input4" placeholder="DNI">
				    	</div>
				  	</div>
				  	<div class="form-group">
				    	<label style="text-align:right;padding-right:0;" for="input5" class="col-lg-2 control-label">Correo</label>
				    	<div class="col-lg-10">
				      		<input name="data[Solicitante][correo]" type="text" class="form-control" id="input5" placeholder="Correo">
				    	</div>
				  	</div>
				  	<div class="form-group">
				  		<label style="text-align:right;padding-right:0;" for="input5" class="col-lg-2 control-label">Unidad</label>
						<div class="col-lg-10">
					  	<select class="form-control" name="data[Solicitante][unidades_id]">
					  	<?php
					  	foreach($unidades as $u){
					  	?>
						  <option value=<?php echo "'".$u['Unidade']['id']."'"; ?>><?php echo $u['Unidade']['nombre']; ?></option>
					  	<?php 
						}
					  	?>
						</select>
						</div>
					</div>
	        	<div class="modal-footer">
	          		<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
	          		<input type="submit" class="btn btn-primary" value="Guardar"/>
	        	</div>
			</form>
		</div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<script>
	$('#options a').tooltip()
</script>